﻿<UserControl x:Class="FR.SAFTAnalyser.Views.Tools.SaveToBDView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:avalonDock="http://avalondock.codeplex.com"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Background="{DynamicResource Background}">
    <UserControl.Resources>
        <avalonDock:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
    </UserControl.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="30" />
            <RowDefinition Height="*" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="25*"/>
            <ColumnDefinition Width="75*"/>
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Grid.ColumnSpan="2" Margin="3" VerticalAlignment="Stretch" TextWrapping="Wrap"
                   Text="Esta ferramenta permite guardar o ficheiro SAF-T PT numa base de dados. A base de dados será criada, ou substituída se já existir."/>
       
        
        <TextBlock Text="Ligação:" Grid.Row="1" Grid.Column="0" Margin="3"  />
        <TextBox Text="{Binding ConnectionString}" Grid.Row="1" Grid.Column="1" Margin="3" Height="25"/>

        <CheckBox Grid.Row="2" Grid.Column="1" Margin="3" Height="25" VerticalAlignment="Top" HorizontalAlignment="Right"
                  Content="Apaga todos os dados existentes" 
                  IsChecked="{Binding ReCreateBD}" Visibility="Hidden"/>

        <TextBlock Grid.Row="3" Grid.ColumnSpan="2" Margin="5"
                   Text="{Binding Messages}"/>
        
        <ProgressBar Grid.Row="4" Grid.ColumnSpan="2" Margin="3" Height="25" VerticalAlignment="Bottom"
                     Minimum="0" Maximum="100" IsIndeterminate="False"
                     Value="{Binding CurrentStep, IsAsync=True}" 
                     Visibility="{Binding IsWorking, Converter={StaticResource BoolToVisibilityConverter}}"/>
        
        <Button Width="85" Height="25" Grid.Row="5" Grid.Column="1" Margin="3" HorizontalAlignment="Right" VerticalAlignment="Bottom"
                Command="{Binding SaveCommand}" >
            <StackPanel Orientation="Horizontal">
                <Image Source="..\..\Resources\Images\bd.ico"/>
                <TextBlock Text="Guardar" Padding="5,0,0,0" FontSize="14"/>
            </StackPanel>
        </Button>
        
    </Grid>
</UserControl>
